<extend name="template/base_index" />


<block name="area_header">

	<link rel="stylesheet" type="text/css" media="all" href="__CDN__/jquery-datetimepicker/jquery.datetimepicker.css">
	<script type="text/javascript" src="__CDN__/jquery-datetimepicker/jquery.datetimepicker.js"></script>
</block>

<block name="area_body">
	{:W('Menus/topbar')}
	<div class="admin-main container-fluid">
		{:W('Menus/left')}
		<div class="admin-main-content">
			{:W('Menus/breadcrumb')}
			<notempty name="parent_vo">
			<div class="text-center"><h4>上级类目: {$parent_vo.name} </h4></div>
			</notempty>
            <div class="alert alert-info">
                 注意:点击类目名称进入子类目
            </div>
			<!-- 过滤\查询按钮 -->
				<div class="filter-controls">
					<!-- 日期查询 -->
					<form action="{:U('Admin/Category/index',array('parent'=>$parent,'preparent'=>$preparent))}" method="post" class="form-inline">
						<div class="form-group">
							<label>类目名称</label>
							<input type="text" name="name" placeholder="请输入类目名称" value="{$name}" class="form-control"/>
						</div>
						<button type="submit" class="btn btn-default btn-sm"><i class="fa fa-search"></i>{:L('BTN_SEARCH')}</button>
					</form>
				</div>
				<!-- 操作按钮 -->
				<div class="btn-controls">
					<a class="btn btn-primary btn-sm" href="{:U('Admin/Category/add',array('parent'=>$parent,'preparent'=>$preparent,'level'=>($level+1)))}"><i class="fa fa-plus"></i>类目添加</a>
					<neq name="preparent" value="-1">					
						<a href="{:U('Admin/Category/index',array('parent'=>$preparent,'preparent'=>$prepreparent))}" class="btn btn-default btn-sm"><i class="fa fa-reply"></i>返回上一级</a>
					</neq>

				</div>

				<table class="table table-striped table table-hover  table-condensed">
					<thead>
						<tr>
							<th>
								<input type="checkbox" class="selectall" onclick="myUtils.selectall(this,'.selectitem');" />
							</th>
							<th>
								类目名称
							</th>
							<th>
								类目属性/SKU
							</th>
							<th>
								操作
							</th>
						</tr>
					</thead>
					<tbody>
						<empty name="list">
							<tr>
								<td colspan="4" class="text-center">{:L('NO_DATA')}</td>
							</tr>
							<else/>
							<volist name="list" id="vo">
								<tr>
									<td>
										<input type="checkbox" value="{$vo.id}" name="ids[]" class="selectitem" /></td>
									<td>
										<a href="{:U('Admin/Category/index',array('level'=>$vo['level'],'parent'=>$vo['id'],'preparent'=>$vo['parent']))}">{$vo.name}</a>
									</td>
									<td>
                                        <if condition="$vo['level'] gt 1">
										<a href="{:U('Admin/CategoryProp/index',array('cate_id'=>$vo['id']))}" > 属性管理</a>	
										<a href="{:U('Admin/CategorySku/index',array('cate_id'=>$vo['id'],'parent'=>$parent,'preparent'=>$preparent,'level'=>($level)))}" > SKU管理</a>
                                        <else/>
                                            此一级类目不能操作，必须添加二级类目
                                        </if>
                                    </td>
									<td>
										<a href="{:U('Admin/Category/edit',array('id'=>$vo['id'],'parent'=>$vo['parent'],'preparent'=>$preparent))}" class="btn btn-sm btn-default"><i class="fa fa-edit"></i>编辑</a>
										<a href="{:U('Admin/Category/delete',array('id'=>$vo['id']))}" class="btn btn-sm btn-danger ajax-get confirm"><i class="fa fa-trash"></i>删除</a>
									</td>
								</tr>

							</volist>
						</empty>
					</tbody>
				</table>
				<div>{$show}</div>
			</div>

			<script type="text/javascript">
				$(function() {
						$('#startdatetime').datetimepicker({
							lang: 'ch',
							format:'Y-m-d',
							timepicker:false,
						});
						$('#enddatetime').datetimepicker({
							lang: 'ch',
							format:'Y-m-d',
							timepicker:false,
						});
				});
			</script>
		</div>
		<!-- END admin-main-content -->
	</div>
		<!-- END admin-main-->
</block>

<block name="area_footer">

</block>